home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / boot / initrd.img-2.6.20-15-generic / initrd.img-2.6 / scripts / local < prev    next >
Encoding:
Text File  |  2007-05-25  |  2.1 KB  |  81 lines

  1. # Local filesystem mounting            -*- shell-script -*-
  2.  
  3. # Parameter: Where to mount the filesystem
  4. mountroot ()
  5. {
  6.     [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top"
  7.     run_scripts /scripts/local-top
  8.     [ "$quiet" != "y" ] && log_end_msg
  9.  
  10.     # If the root device hasn't shown up yet, give it a little while
  11.     # to deal with removable devices
  12.     if [ ! -e "${ROOT}" ] || ! /lib/udev/vol_id "${ROOT}" >/dev/null 2>&1; then
  13.         log_begin_msg "Waiting for root file system..."
  14.  
  15.         # Default delay is 180s
  16.         if [ -z "${ROOTDELAY}" ]; then
  17.             slumber=180
  18.         else
  19.             slumber=${ROOTDELAY}
  20.         fi
  21.         if [ -x /sbin/usplash_write ]; then
  22.             /sbin/usplash_write "TIMEOUT ${slumber}" || true
  23.         fi
  24.  
  25.         slumber=$(( ${slumber} * 10 ))
  26.         while [ ! -e "${ROOT}" ] || ! /lib/udev/vol_id "${ROOT}" >/dev/null 2>&1; do
  27.             /bin/sleep 0.1
  28.             slumber=$(( ${slumber} - 1 ))
  29.             [ ${slumber} -gt 0 ] || break
  30.         done
  31.  
  32.         if [ ${slumber} -gt 0 ]; then
  33.             log_end_msg 0
  34.         else
  35.             log_end_msg 1 || true
  36.         fi
  37.         if [ -x /sbin/usplash_write ]; then
  38.             /sbin/usplash_write "TIMEOUT 15" || true
  39.         fi
  40.     fi
  41.  
  42.     # We've given up, but we'll let the user fix matters if they can
  43.     while [ ! -e "${ROOT}" ]; do
  44.         echo "    Check root= bootarg cat /proc/cmdline"
  45.         echo "    or missing modules, devices: cat /proc/modules ls /dev"
  46.         panic "ALERT!  ${ROOT} does not exist.  Dropping to a shell!"
  47.     done
  48.  
  49.     # Get the root filesystem type if not set
  50.     if [ -z "${ROOTFSTYPE}" ]; then
  51.         eval $(fstype < ${ROOT})
  52.     else
  53.         FSTYPE=${ROOTFSTYPE}
  54.     fi
  55.     if [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then
  56.         FSTYPE=$(/lib/udev/vol_id -t ${ROOT})
  57.         [ -z "$FSTYPE" ] && FSTYPE="unknown"
  58.     fi
  59.  
  60.     [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount"
  61.     run_scripts /scripts/local-premount
  62.     [ "$quiet" != "y" ] && log_end_msg
  63.  
  64.     if [ ${readonly} = y ]; then
  65.         roflag=-r
  66.     else
  67.         roflag=-w
  68.     fi
  69.  
  70.     # FIXME This has no error checking
  71.     modprobe -Qb ${FSTYPE}
  72.  
  73.     # FIXME This has no error checking
  74.     # Mount root
  75.     mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt}
  76.  
  77.     [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom"
  78.     run_scripts /scripts/local-bottom
  79.     [ "$quiet" != "y" ] && log_end_msg
  80. }
  81.